//
//  Ant.h
//  AntSimulation
//


#ifndef __AntSimulation__Ant__
#define __AntSimulation__Ant__

#include <iostream>
#include <time.h>
#include <stdlib.h>

#include "Item.h"
#include "Details.h"
#include "Area.h"
#include "Food.h"//for rtti
#include "Anthill.h"


class Ant : public Item, public Details {
    
public:
	Ant();
	~Ant(void);
	void act();
	void printName();

	void set_hasFood(bool);//true: the ant has 1 unit of food, false: it hasn't
	bool get_hasFood(void);//returns true, if the ant has food, otherwise the returnvalue will be false

	void set_livecount(unsigned int);//sets the livecount of the ant, max=50
	unsigned get_livecount(void);//returns the remaining rounds the ant has to live
	void decrease_livecount(void);//livecount -1
	void increase_livecount(void);//livecount +1
	
	void setCurrArea(Area*);//sets the pointer to the area, where the ant currently stays
	Area* getCurrArea(void);//returns the pointer of the current position
	void setNextArea(Area*);//sets the pointer to the area, where the ant wants to go
	Area* getNextArea(void);//returns the pointer of the next Area
	void setLastArea(Area*);//sets the pointer to the area, where the ant comes from
	Area* getLastArea(void);//returns the pointer of the last Area
		
private:
	bool hasFood;//true if the ant has on unit of food, otherwise false
	bool alreadyActed;//true if the ant has already acted in the current round, otherwise false
	unsigned livecount;//saves the remaining rounds the ant has to live
	Area* curr_area;// a pointer to the area, at wich the ant currently stays
	Area* next_area;//pointer to the area the ant wants to go in the next round
	Area* last_area;//pointer to the area the ant was in the last round

	unsigned int pheromoneIntesity;//The greater the distance to the found food is, the lower is the phIntensity, start=5;
		
	unsigned int get_max(unsigned,unsigned);
	Area* calcNextArea(Area*);//finds the area, where the ant will move on its next turn

	int distance2food;
	
	//Stores the amount of areas moved in x and y coordinates
	int diffXmoved;
	int diffYmoved;

	//std::list<unsigned int> waybackhome;//1=north, 2=east, 3=south, 4=west

	std::list<Area*> visitedAreas;//For finding the way back home faster, under Cunstruction...
	bool visitedAreasCleaned;
	
};
#endif /* defined(__AntSimulation__Ant__) */

